import { container } from "tsyringe";
import { RunableTask } from "./task";
import { Context } from "./ctx";
import { CURRENT_APP } from "./app";
import { HomeApp } from "./HomeApp";

export class TakeRedPacketTask extends RunableTask {
    title: string = `抢红包`;
    type: string = `TakeRedPacketTask`
    run() {
        // 1. 从服务器获取红包信息
        // 2. 进入直播间 抢红包
        // 3. 等待开奖
        // 4. 回到桌面
    }
    canRun(): boolean {
        const ctx = container.resolve(Context)
        const currentApp = ctx.get(CURRENT_APP)
        /**
         * 在首页就可以运行
         */
        if (currentApp && HomeApp.is(currentApp)) {
            return true;
        }
        return false;
    }
    stop(): void {

    }
}